#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int arr[4][4] = { 0 };
	int r, c;
	for (r = 0; r < 4; r++)
	{
		for (c = 0; c < 4; c++)
		{
			scanf("%d", &arr[r][c]);
		}
	}
	int target = 0;
	scanf("%d", &target);
	r = 0; c = 3;
	while (r <= 3 && c >= 0)
	{
		if (arr[r][c] == target)
		{
			printf("true\n"); break;
		}
		else if (arr[r][c] < target)
		{
			r++;
		}
		else if (arr[r][c] > target)
		{
			c++;
		}
	}
	if (r > 3 || c < 0)
	{
		printf("false\n");
	}


	return 0;
}